import request from "@/utils/request";


export const getLogin = (info) => {
  //return request.post("user/login", info)
  return request({
    method: "post",
    url: "user/login",
    data: info,
  });
};


export const deleteNewsByHid = (hid) => {
  return request({
    method: "delete",
    url: `newline/${hid}`,
  });
};


//上传图片
export const uploadImageApi = (formData) => {
  return request({
    method: "post",
    url: 'file/image',
    data: formData,
    headers: {
      "Content-Type": "multipart/form-data",
    },
    timeout: 60000,
  });
};

//查询公司
export const queryByCompanyName=(companyName)=>{
  return request({
    method: "get",
    url: `company/${companyName}`,
  });
}

//热门投诉公司
export const hotCompanyList=()=>{
  return request({
    method: "get",
    url: "company/hotCompanyList",
  });
}

//投诉热门问题展示列表
export const hotProblemTagsList=(merchantName)=>{
    return request({
    method: "get",
    url: `complaints/HotQuestions/${merchantName}`,
  });
}
//投诉热门要求展示列表
export const hotRequirementTagsList=(merchantName)=>{
    return request({
    method: "get",
    url: `complaints/HotRequires/${merchantName}`,
  });
}

//插入投诉数据
export const complaintsValue=(formData)=>{
  return request({
    method: "post",
    url: "complaints/InsertComplaints",
    data: formData,
  });
}

export const getUser = () => {
  return request({
    method: "get",
    url: "user/getUser"
  });
};


export const getMainTabs = (params) => {
  return request({
    method: "get",
    url: "type",
    params: params
  });
};

//红黑榜获取排行榜数据
export const getRankingData = (tid) => {
  return request({
    method: "get",
    url: `company/ranking/${tid}`,
  });
};


// 获取首页分页信息
export const getFindMainComplaintsPage = (info) => {
    return request({
        method:'post',
        url:'complaints/findComplaintsPage',
        data:info
    })
}
// 注册接口
export const register = (userInfo) => {
  return request({
    method: 'post',
    url: 'user/register',
    data: userInfo,
  });
};

// 获取投诉详细信息
export const getFindComplaintsDetail = (cId) => {
  return request({
    method:'get',
    url:`complaints/findComplaintsDetail/${cId}`
  })
}

export const getFindMainComplaintsPageByCompanyId = (info) => {
    return request({
        method:'post',
        url:'complaints/findComplaintsPageByCompanyId',
        data:info
    })
}



// 查询导游
export const queryGuide = (data) => {
  return request({
    method: "post",
    url: "/api/guide",
    data: data,
    headers: {
      "Content-Type": "application/x-www-form-urlencoded",
    },
  });
};

// 查询旅行社
export const queryAgency = (data) => {
  return request({
    method: "post",
    url: "/api/agency",
    data: data,
    headers: {
      "Content-Type": "application/x-www-form-urlencoded",
    },
  });
};

// 查询电子合同
export const queryContract = (data) => {
  return request({
    method: "post",
    url: "/api/contract",
    data: data,
    headers: {
      "Content-Type": "application/x-www-form-urlencoded",
    },
  });
};

//重置密码接口
export const directResetPwd = (username, newPassword) => {
  return request({
    url: '/user/resp',
    method: 'post',
    params: {
      username,
      newPassword
    }
  });
};

